package org.stu.tp.testCases.userInfo;

import org.stu.tp.core.*;

public class UserInfoSac extends BaseSac{
	
	/**
	 * @param selenium
	 * selenium set or get those fields.
	 */
	public String getLoginId(DefaultAjaxSelenium selenium) {
		return selenium.getText("lblAccount");
	}

	public String getName(DefaultAjaxSelenium selenium) {
		return selenium.getText("lbName");
	}
	
	public void setPass(DefaultAjaxSelenium selenium,String pass) {
		selenium.type("tbUserPassword", pass);
	}

	public void setEamil(DefaultAjaxSelenium selenium,String email) {
		selenium.type("tbRegisterEmail",email);
	}
	
	public String getEmail(DefaultAjaxSelenium selenium){
		return selenium.getText("tbRegisterEmail");
	}
	
	public void setAddress(DefaultAjaxSelenium selenium,String address) {
		selenium.type("tbAddress", address);
	}
	
	public String getAddress(DefaultAjaxSelenium selenium){
		return selenium.getText("tbAddress");
	}
	
	public void setConPass(DefaultAjaxSelenium selenium,String conPass) {
		selenium.type("tbPassWordAgain", conPass);
	}

	
//	actions
	
	/**
	 * Access user info and wait for the first edit field visible.
	 * @param selenium
	 * access to the page of userInfo.
	 */
	public void accessUserInfo(DefaultAjaxSelenium selenium){
		selenium.clickAt("wb_0_Item_0", "");
		try{selenium.waitForVisible("tbUserPassword");
			}catch(Exception e){
				e.printStackTrace();
			}
		
	}

	/**
	 * @param selenium
	 * click the save button or cancel button.
	 */
	public void clickAtSaveButton(DefaultAjaxSelenium selenium){
		selenium.click("imgbtnSure");
	}
	public void clickAtCancelButton(DefaultAjaxSelenium selenium){
		selenium.click("imgbtnCancel");
	}
	
	

}
